package keer.httpinterface.annotation;

import keer.httpinterface.HttpInterceptor;
import keer.httpinterface.http.ContentTypes;
import keer.httpinterface.http.HttpMethod;
import keer.httpinterface.proxy.ContentBodyRequestAnnotationConfigure;
import keer.httpinterface.utils.ConstantUtils;

import java.lang.annotation.*;

/**
 * 用于标注接口请求的http方法为PATCH
 * @see Request
 * @see Header
 * @see Param
 * @see ContentBodyRequestAnnotationConfigure
 *
 * @author Keer
 * @since 1.0.0
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
@Request(configure = ContentBodyRequestAnnotationConfigure.class, body = true,method = HttpMethod.PATCH)
public @interface Patch {
    /**
     * 请求地址
     * @return
     */
    @Alias(annotation = Request.class, property = "url")
    String url() default "";

    /**
     * 请求地址
     * @return
     */
    @Alias(property = "url")
    String value() default "";

    /**
     * 请求头
     * @return
     */
    @Alias(annotation = Request.class, property = "headers")
    Header[] headers() default {};

    /**
     * 请求参数
     * @return
     */
    @Alias(annotation = Request.class, property = "params")
    Param[] params() default {};

    /**
     * 请求体类型
     * @return
     */
    @Alias(annotation = Request.class, property = "contentType")
    String contentType() default ContentTypes.APPLICATION_JSON;

    /**
     * 请求体编码
     * @return
     */
    @Alias(annotation = Request.class, property = "charset")
    String charset() default ConstantUtils.DEFAULT_CHARSET;

    /**
     * 请求拦截器
     * @see HttpInterceptor
     * @return
     */
    @Alias(annotation = Request.class, property = "interceptors")
    Class<? extends HttpInterceptor>[] interceptors() default {};
}
